Various methods are known for aligning a document to a template, and are particularly used in the field of optical character recognition (OCR). For example, one known technique for aligning a template with a document is to calculate correlation factors between a plurality of reference character templates and each in a sequence of document characters, at a variety of different relative positions, and to select the highest correlation factor for each character. Such a technique, while yielding accurate positioning data and simultaneously providing a starting set of OCR data, is computationally too intensive to yield economical throughput. That is, because each correlation factor involves on the order of n 2 calculations (where n is the height in pixels of a typical character and is ordinarily around 40) and because a typical library of reference character templates has about 100 entries, the number of calculations needed to obtain a correlation factor for each template is already very high. To add even a small 3×3 grid search for the highest correlation factor for each template, so as to verify common orientation of document and template, multiplies that already high number by a factor of 9. Moreover, this technique provides little assurance that a scanned document has been fully scanned—in other words, a vertical streak of letters missed due to, e.g., folding during document feeding, may not be detected. Failure to detect missed characters can be of particular consequence during automated processing of documents such as, e.g., tax forms, mortgage disclosures, or other financial papers. However, OCR done with a reliable level of assurance as to completeness can greatly enhance efficiency of document processing for exactly these sorts of documents, which typically are based on standard templates.
Thus, it is generally desirable to have a document to template alignment method that is customizable and is able to detect misalignments with a high degree of certainty. Moreover, it is desirable to have a method that reduces CPU time costs.